<?php
header('Content-Type: text/html; charset=ISO-8859-1');
if (isset($_REQUEST['pos'])){
  $inicio=$_REQUEST['pos'];
}
else{
  $inicio=0;
  $cero=0;
}
include("admin/cls/sesion.php");
include("admin/cls/cls_user.php");

session_start();
if(!$_SESSION[""]->nombre)
	{
		header("Location:index.html");
	}
//echo $_SESSION[""]->nombre; 
//$user_id=$_SESSION[""]->id;
  $user_id=$_GET['user_id']; 


	$user = new cls_user ();
	$var=$user->getComments2($user_id,$inicio);
	//$data=$user->getUserData($user_id);
	//echo $query;
	echo "<table align=center border=0 bgcolor=#ffffff cellspacing=5 bordercolor=red  style='width:550px;'>";
	$impresos=0;
	while($reg = mysql_fetch_array($var)){
		$impresos++;
		echo "<tr><td >";
			if(($user->getImageProfile($reg["user_id"]))!=-1){
				$val=$user->getImageProfile($reg["user_id"]);
				while($mostrar = mysql_fetch_array($val)){
				$image_id=$mostrar['image_id'];
			
				echo "<a href='profileUser.php?user_id=$reg[user_id]'>";
				echo "<img src='getImages.php?image_id=$image_id' WIDTH=50 HEIGHT=50></a>";
		echo "</td>";
			}
		}else{
		$image_id=null;
		echo "<a href='profileUser.php?user_id=$reg[user_id]'>";
		echo "<img src='files_users/defprof.jpg'></a>";
		echo "</td>";
		}

		echo "<td>";
		echo "<font color=black>";
		echo $reg["name"];
		echo "</font>";
		echo "</td>";

		echo "<td>";
		echo "<font color=black>";
		echo $reg["content"];
		echo "</font>";
		echo "</td>";
		echo "</tr>";
		}
		mysql_free_result($var);
		echo "</table>";
		
	    if ($inicio==0)
	        echo "anteriores ";
	    else
	    {
	        $anterior=$inicio-3;
	        echo "<a href=\"get_comments.php?pos=$anterior+&user_id=$user_id\" id=\"ant\">Anteriores </a>";
	    }
	    if ($impresos==3)
	    {
	        $proximo=$inicio+3;
	        echo "<a href=\"get_comments.php?pos=$proximo+&user_id=$user_id\" id=\"sig\">Siguientes</a>";
	    }else
	        echo "siguientes";
?>
